// pages/activetyDetail/activetyDetail.js
var WxParse = require('../../wxParse/wxParse.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    
  },
  
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    // console.log(options.goods_id)
    this.getActivetyDetail(26);
    var priceExplain = document.getElementById('priceExplain');
    console.log(priceExplain)
  },

  telephone: function() {
    wx.showActionSheet({
      itemList: ['0731-10020030'],
      success: function(res) {
        console.log(res.tapIndex);
        wx.makePhoneCall({
          phoneNumber: '15116300032',
        })
      }
    })  
  },

  closeMap: function() {

  },

  /**
   *  获取活动详情性息
   */
  getActivetyDetail: function(id) {
    var that = this;
    var goods_id = id;
    wx.request({
      url: 'http://api.shijian666.com/peony/activity/getActivityDetails',
      data: {
        token: 123,
        goods_id: goods_id,
        user_id: 11419
      },
      success: function(res) {
        console.log(res.data)
        var res = res.data;
        if (res.code == 0) {
          that.setData({
            activetyDetail: res.data.result
          });
          var article = res.data.result.detailed_introduction;
          var article1 = res.data.result.registration_instructions
          WxParse.wxParse('article', 'html', article, that);
          WxParse.wxParse('article1', 'html', article1, that);
        }
      }
    })
  },
  scroll: function(e) {
    console.log(e.detail.scrollTop);
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})